
local M = {}

M.bit = {}


function M.bit.lshift(x, n)
    return x << n
end

function M.bit.rshift(x, n)
    return x >> n
end

local function bit_bor(a, b, c, ...)
    if c then
        return bit_bor(a | b, c, ...)
    elseif b then
        return a | b
    else
        return a
    end
end
M.bit.bor = bit_bor

local function bit_band(a, b, c, ...)
    if c then
        return bit_band(a & b, c, ...)
    elseif b then
        return a & b
    else
        return a
    end
end
M.bit.band = bit_band

local function bit_bxor(a, b, c, ...)
    if c then
        return bit_band(a ~ b, c, ...)
    elseif b then
        return a ~ b
    else
        return a
    end
end
M.bit.bxor = bit_bxor


return M